package com.ftg.learn.chapter08;

import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author kangjx
 * @createTime 2022/7/7
 */
public class TestMap {

    public static void main(String[] args) {
        Map<String,Object> map1 =new Hashtable<>();
        Map<String,Object> map3 = new ConcurrentHashMap<>(3);
        map3.put("tt",123);
//        map1.put(null,"abc");
//        map1.put("a",null);
//        脏读   幻读

        Map<String,Object> map = new HashMap<>();
        //区别: 同是map的实现类,hashmap非线程安全，速度快  Hashtable 线程安全的，速度慢，安全级别高
        map.put(null,123);
        map.put("a",null);
//        map.put(null,null);

        System.out.println(map.get(null));
        System.out.println(map.get("a"));

    }

}
